import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/api/v1/token',
    method: 'post',
    data
  })
}

// 版本信息
export function authVersion() {
	return request({
		url: '/api/v1/auth/version',
		method: 'get'
	})
}


export function getInfo() {
  return request({
    url: '/api/v1/user/info',
    method: 'get'
  })
}

export function logout() {
  return request({
    url: '/user/logout',
    method: 'post'
  })
}

export function user(param){
	return request({
		url: '/api/v1/user',
		method: 'get',
		params: param
	})
}

export function group(param){
	return request({
		url: '/api/v1/group',
		method: 'get',
		params: param
	})
}

export function manufactor(param){
	return request({
		url: '/api/v1/manufactor',
		method: 'get',
		params: param
	})
}

export function product(param){
	return request({
		url: '/api/v1/product',
		method: 'get',
		params: param
	})
}

export function productLine(param){
	return request({
		url: '/api/v1/product/line',
		method: 'get',
		params: param
	})
}
//
export function prototype(param){
	return request({
		url: '/api/v1/prototype',
		method: 'get',
		params: param
	})
}

//
export function doc(param){
	return request({
		url: `/api/v1/prototype/doc/${param}`,
		method: 'get'
	})
}

//
export function prototypeId(param){
	return request({
		url: `/api/v1/prototype/${param}`,
		method: 'get'
	})
}
//
export function docDelete(param){
	return request({
		url: `/api/v1/prototype/doc/${param}`,
		method: 'DELETE'
	})
}

// 测试任务文档-删除
export function taskdocDelete(param){
	return request({
		url: `/api/v1/task/doc/${param}`,
		method: 'DELETE'
	})
}

export function userList(param){
	return request({
		url: `/api/v1/user/list`,
		method: 'get'
	})
}

export function sign(param){
	return request({
		url: `/api/v1/prototype/${param}/sign`,
		method: 'post'
	})
}

export function recode(param){
	return request({
		url: `/api/v1/prototype/${param}/recode`,
		method: 'get'
	})
}
//
export function prototypeTest(param){
	return request({
		url: `/api/v1/prototype/${param}`,
		method: 'post'
	})
}
//
export function options(param){
	return request({
		url: `/api/v1/prototype/options`,
		method: 'get'
	})
}

//
export function order(param){
	return request({
		url: `/api/v1/order`,
		method: 'get',
		params: param
	})
}
//
export function orderOptions(param){
	return request({
		url: `/api/v1/order/options`,
		method: 'get'
	})
}

// 订单-用例-批量删除
export function orderMult(param){
	return request({
		url: `/api/v1/order/case/mult`,
		method: 'DELETE',
		data:param
	})
}

export function productList(param){
	return request({
		url: `/api/v1/product/list?product_line_id=${param}`,
		method: 'get'
	})
}

//
export function manufactorList(param){
	return request({
		url: `/api/v1/manufactor/list`,
		method: 'get'
	})
}
//
export function productLineList(param){
	return request({
		url: `/api/v1/product/line/list`,
		method: 'get'
	})
}

//
export function groupList(param){
	return request({
		url: `/api/v1/group/list`,
		method: 'get'
	})
}

export function groupId(param){
	return request({
		url: `/api/v1/group/${param}`,
		method: 'get'
	})
}

//
export function orderSure(param){
	return request({
		url: `/api/v1/order`,
		method: 'post',
		data:param
	})
}

// 样机入库
export function prototypeGodown(param){
	return request({
		url: `/api/v1/prototype/${param}/godown`,
		method: 'post'
	})
}

// 样机-归还 /prototype/<id>/return
export function prototypeReturn(param){
	return request({
		url: `/api/v1/prototype/${param}/return`,
		method: 'post'
	})
}

//
export function orderDetail(param){
	return request({
		url: `/api/v1/order/${param}`,
		method: 'get'
	})
}

// 删除用例
export function orderCase(param){
	return request({
		url: `/api/v1/order/case/${param}`,
		method: 'DELETE'
	})
}

// 删除测试任务里的测试用例
export function taskCase(param){
	return request({
		url: `/api/v1/task/case/${param}`,
		method: 'DELETE'
	})
}

export function orderCaseId(param,id){
	return request({
		url: `/api/v1/order/case/${id}`,
		method: 'post',
		data:param
	})
}

export function statistic(param){
	return request({
		url: `/api/v1/order/${param}/case/statistic`,
		method: 'get'
	})
}



// 全量样机列表
export function prototypeList(param){
	return request({
		url: `/api/v1/prototype/list`,
		method: 'get'
	})
}

// 归还样机
export function prototypeIdBack(param,id){
	return request({
		url: `/api/v1/prototype/${id}/back`,
		method: 'post',
		data:param
	})
}

// 测试任务文档-下载计数
export function taskDoc(param){
	return request({
		url: `/api/v1/task/doc/${param}`,
		method: 'get'
	})
}

// 任务列表
export function orderTask(param){
	return request({
		url: `/api/v1/order/${param}/task`,
		method: 'get'
	})
}

// 测试任务-参数
export function taskOptions(param){
	return request({
		url: `/api/v1/task/options`,
		method: 'get'
	})
}

// 创建任务
export function orderIdTask(param,id){
	return request({
		url: `/api/v1/order/${id}/task`,
		method: 'post',
		data:param
	})
}

// 测试任务-列表
export function task(param){
	return request({
		url: `/api/v1/task`,
		method: 'get',
		params: param
	})
}

// 测试任务-详情
export function taskId(param){
	return request({
		url: `/api/v1/task/${param}`,
		method: 'get'
	})
}

// 测试任务-修改
export function taskIdPost(param,id){
	return request({
		url: `/api/v1/task/${id}`,
		method: 'post',
		data:param
	})
}
// 测试任务-填写测试用例结果
export function taskCasePost(param,id){
	return request({
		url: `/api/v1/task/case/${id}`,
		method: 'post',
		data:param
	})
}

// 测试任务-测试用例详情
export function taskCaseGet(param){
	return request({
		url: `/api/v1/task/case/${param}`,
		method: 'get'
	})
}

// 订单-用例列表
export function orderIdCase(param){
	return request({
		url: `/api/v1/order/${param}/case`,
		method: 'get'
	})
}

// 订单-用例模板
export function caseTemplate(param){
	return request({
		url: `/api/v1/order/case/template`,
		method: 'get'
	})
}

// 样机-位置列表
export function localtion(param){
	return request({
		url: `/api/v1/prototype/localtion`,
		method: 'get'
	})
}

// 测试设备-列表
export function device(param){
	return request({
		url: `/api/v1/device`,
		method: 'get',
		params: param
	})
}

// 测试设备-新增
export function devicePost(param){
	return request({
		url: `/api/v1/device`,
		method: 'post',
		data:param
	})
}

//测试设备-筛选/新增参数
export function deviceOptions(param){
	return request({
		url: `/api/v1/device/options`,
		method: 'get'
	})
}

// 测试设备-详情
export function deviceId(param){
	return request({
		url: `/api/v1/device/${param}`,
		method: 'get'
	})
}

// 测试设备-修改 /device/<id>
export function deviceIdPost(param,id){
	return request({
		url: `/api/v1/device/${id}`,
		method: 'post',
		data:param
	})
}

// 测试设备-操作记录
export function deviceRecode(param){
	return request({
		url: `/api/v1/device/${param}/recode`,
		method: 'get'
	})
}
// 测试设备-借出
export function deviceTransfer(param,id){
	return request({
		url: `/api/v1/device/${id}/transfer`,
		method: 'post',
		data:param
	})
}

// 测试设备-确认接收
export function deviceSign(param){
	return request({
		url: `/api/v1/device/${param}/sign`,
		method: 'post'
	})
}

// 测试设备-入库
export function deviceGodown(param){
	return request({
		url: `/api/v1/device/${param}/godown`,
		method: 'post'
	})
}

// 报价单-列表
export function quotation(param){
	return request({
		url: `/api/v1/quotation`,
		method: 'get',
		params: param
	})
}

// 报价单-新增
export function quotationPost(param){
	return request({
		url: `/api/v1/quotation`,
		method: 'post',
		data:param
	})
}

// 报价单-详情
export function quotationId(param){
	return request({
		url: `/api/v1/quotation/${param}`,
		method: 'get'
	})
}
// 报价单-修改 /quotation/<id>
export function quotationIdPost(param,id){
	return request({
		url: `/api/v1/quotation/${id}`,
		method: 'post',
		data:param
	})
}

// 报价单-服务-新增  /quotation/service
export function quotationService(param){
	return request({
		url: `/api/v1/quotation/service`,
		method: 'post',
		data:param
	})
}

// 报价单-服务-列表
export function quotationGetService(param){
	return request({
		url: `/api/v1/quotation/${param}/service`,
		method: 'get'
	})
}

// 报价单-服务-删除  /quotation/service/<id>
export function serviceDelete(param){
	return request({
		url: `/api/v1/quotation/service/${param}`,
		method: 'DELETE'
	})
}

// 报价单-服务-修改
export function quotationServiceId(param,id){
	return request({
		url: `/api/v1/quotation/service/${id}`,
		method: 'post',
		data:param
	})
}

// 测试任务-提交测试任务到测试组长
export function taskSubmit(param){
	return request({
		url: `/api/v1/task/${param}/submit`,
		method: 'post'
	})
}

// 缺陷管理-列表
export function bug(param){
	return request({
		url: `/api/v1/bug`,
		method: 'get',
		params: param
	})
}

// 缺陷管理-选项
export function bugOptions(param){
	return request({
		url: `/api/v1/bug/options`,
		method: 'get'
	})
}

// 缺陷管理-新增 /bug
export function bugPost(param){
	return request({
		url: `/api/v1/bug`,
		method: 'post',
		data:param
	})
}

// 缺陷管理-指派
export function bugAssign(param,id){
	return request({
		url: `/api/v1/bug/${id}/assign`,
		method: 'post',
		data:param
	})
}

// 角色-列表
export function roleOption(param){
	return request({
		url: `/api/v1/user/list?role=${param}`,
		method: 'get'
	})
}

// 缺陷管理-操作记录
export function bugRecode(param){
	return request({
		url: `/api/v1/bug/${param}/recode`,
		method: 'get'
	})
}

// 缺陷管理-驳回 /bug/<id>/rebut
export function bugRebut(param,id){
	return request({
		url: `/api/v1/bug/${id}/rebut`,
		method: 'post',
		data:param
	})
}

// 缺陷管理-验证 /bug/<id>/verification
export function bugVerification(param,id){
	return request({
		url: `/api/v1/bug/${id}/verification`,
		method: 'post',
		data:param
	})
}

// 缺陷管理-重新提交
export function bugResubimit(param,id){
	return request({
		url: `/api/v1/bug/${id}/resubmit`,
		method: 'post',
		data:param
	})
}

// 报价单-生成pdf
export function quotationPdf(param){
	return request({
		url: `/api/v1/quotation/${param}/pdf`,
		method: 'post'
	})
}

// 报价单-pdf列表 /quotation/<id>/pdf
export function quotationPdfGet(param){
	return request({
		url: `/api/v1/quotation/${param}/pdf`,
		method: 'get'
	})
}

// 测试报告-新增
export function report(param){
	return request({
		url: `/api/v1/report`,
		method: 'post',
		data:param
	})
}

// 测试报告-列表
export function reportGet(param){
	return request({
		url: `/api/v1/report`,
		method: 'get',
		params:param
	})
}

// 测试报告-详情
export function reportId(param){
	return request({
		url: `/api/v1/report/${param}`,
		method: 'get'
	})
}

// 测试报告-修改
export function reportEdit(param,id){
	return request({
		url: `/api/v1/report/${id}`,
		method: 'post',
		data:param
	})
}

// 测试报告-审核
export function reportExamine(param,id){
	return request({
		url: `/api/v1/report/${id}/examine`,
		method: 'post',
		data:param
	})
}

// 测试报告-筛选参数
export function reportOptions(param){
	return request({
		url: `/api/v1/report/options`,
		method: 'get'
	})
}
// 缺陷管理-详情
export function bugId(param){
	return request({
		url: `/api/v1/bug/${param}`,
		method: 'get'
	})
}

// 工作台-待办
export function workbenchPending(param){
	return request({
		url: `/api/v1/workbench/pending`,
		method: 'get'
	})
}
